﻿namespace Blaze.ConfigExportTool.Exceptions
{
    using System;
    using System.Text;
    using Aspose.Cells;

    /// <summary>
    /// 某一区域的配置有问题的异常。
    /// </summary>
    public class InvalidSettingInRangeException : ExportException
    {
        public InvalidSettingInRangeException(Cell beginCell, Cell endCell, Exception e)
            : base(e)
        {
            mBeginCell = beginCell;
            mEndCell = endCell;
        }

        protected override void AppendDetailMessage(StringBuilder buffer)
        {
            buffer.AppendFormat("文件：{0}\r\n ", mBeginCell.Worksheet.Workbook.FileName);
            buffer.AppendFormat("工作簿：{0}\r\n ", mBeginCell.Worksheet.Name);
            buffer.AppendFormat("起始单元格：{0}\r\n ", mBeginCell.Name);
            buffer.AppendFormat("结束单元格：{0}\r\n ", mEndCell.Name);
            base.AppendDetailMessage(buffer);
        }

        private readonly Cell mBeginCell;
        private readonly Cell mEndCell;
    }
}